
// import { ADDCOUNTER, SUBCOUNTER } from './actionType'
import * as actionTypes from './actionType'

const initialState = {
  counter: 10,
  banners: [],
  recommends: []
}


function reducer (state = initialState, action) {
  console.log(action);
  switch (action.type) {
    case actionTypes.ADDCOUNTER:
      return { ...state, counter: state.counter + action.counter }
    case actionTypes.SUBCOUNTER:
      return { ...state, counter: state.counter + action.counter }

    case actionTypes.ADDBANNER:
      return { ...state, banners: action.banner }
    case actionTypes.ADDPRODUCTLIST:
      return { ...state, recommends: action.productList }
    default:
      return state;
  }
}

export default reducer